package xyz.hubery.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import xyz.hubery.enums.TaskResultStatus;

/**
 * 任务处理结果
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TaskResult {
    private TaskResultStatus status;
    private String message;
    private Object data; // 业务流转时需要传递的数据
    
    public static TaskResult success() {
        return new TaskResult(TaskResultStatus.SUCCESS, "处理成功",null);
    }
    public static TaskResult success(Object data) {
        return new TaskResult(TaskResultStatus.SUCCESS, "处理成功",data);
    }
    
    public static TaskResult retry(String message) {
        return new TaskResult(TaskResultStatus.RETRY, message,null);
    }
    
    public static TaskResult failed(String message,Object data) {
        return new TaskResult(TaskResultStatus.FAILED, message,data);
    }
    public static TaskResult failed(String message) {
        return new TaskResult(TaskResultStatus.FAILED, message,null);
    }
    
    public static TaskResult skipped(String message) {
        return new TaskResult(TaskResultStatus.SKIPPED, message,null);
    }
}

